<?php
namespace app\cms\loglic;

class Config
{
    public function fields($data=[])
    {
        $themes = DcThemeOption('cms');
    
        $items  = DcFormItems([
            'theme' => [
                'type'   =>'select', 
                'value'  => config('cms.theme'), 
                'option' => $themes,
            ],
            'theme_wap' => [
                'type'   => 'select',
                'value'  => config('cms.theme_wap'),
                'option' => $themes,
            ],
            'slug_first' => [
                'type'       => 'select',
                'value'      => config('cms.slug_first'),
                'option'     => [0=>lang('close'),1=>lang('open')],
            ],
            'request_max' => [
                'type'        => 'number',
                'value'       => intval(config('cms.request_max')),
                'tips'        => lang('cms_request_max_tips'),
            ],
            'search_interval' => [
                'type'        => 'number',
                'value'       => intval(config('cms.search_interval')),
                'tips'        => lang('cms_search_interval_tips'),
            ],
            'search_hot' => [
                'type'        => 'text',
                'value'       => config('cms.search_hot'),
                'rows'        => 3,
                'tips'        => lang('cms_search_hot_tips'),
            ],
            'search_list' => [
                'type'        => 'text',
                'value'       => config('cms.search_list'),
                'rows'        => 3,
                'tips'        => lang('cms_search_list_tips'),
            ],
            'action_name' => [
                'type'       => 'text',
                'value'      => config('cms.action_name'),
                'tips'        => lang('cms_action_name_tips'),
            ],
            'type_option' => [
                'type'       => 'text',
                'value'      => config('cms.type_option'),
                'tips'        => lang('cms_type_option_tips'),
            ],
            'baidu_api' => [
                'type'       => 'text',
                'value'      => config('cms.baidu_api'),
                'tips'       => lang('cms_baidu_api_tips'),
            ],
            'post_pwd' => [
                'type'       => 'text',
                'value'      => config('cms.post_pwd'),
                'tips'       => lang('cms_post_pwd_tips'),
            ],
            'hr_1' => [
                'type'        => 'html',
                'value'       => '<hr>',
            ],
            'limit_index' => [
                'type'        => 'number',
                'value'       => intval(config('cms.limit_index')),
            ],
            'limit_category' => [
                'type'        => 'number',
                'value'       => intval(config('cms.limit_category')),
            ],
            'limit_tag' => [
                'type'        => 'number',
                'value'       => intval(config('cms.limit_tag')),
            ],
            'limit_search' => [
                'type'        => 'number',
                'value'       => DcEmpty(config('cms.limit_search'),10),
            ],
            'limit_filter' => [
                'type'        => 'number',
                'value'       => DcEmpty(config('cms.limit_filter'),10),
            ],
            'limit_sitemap' => [
                'type'        => 'number',
                'value'       => DcEmpty(config('cms.limit_sitemap'),10),
            ],
            'limit_tags' => [
                'type'        => 'number',
                'value'       => DcEmpty(config('cms.limit_tags'),10),
            ],
        ]);
        
        foreach($items as $key=>$value){
            $items[$key]['title'] = lang('cms_'.$key);
            $items[$key]['placeholder'] = '';
        }
        
        return $items;
    }
}